
students = []
def add():
    id = input('请输入班级序号:')
    name = input('请输入班级姓名:')
    age = input('请输入班级年龄:')
    phone = input('请输入班级手机号:')
    student = {'id' : id,'姓名':name,'年龄':age,'手机号':phone}
    students.append(student)
    print('添加成功!')


def delete():
    d_id = input('请输入需要删除的班级序号:')
    for student in students:
        if student["id"] == d_id:
            students.remove(student)
            print('删除成功！')
            return



def update():
    u_id = input('请输入要修改的班级序号:')
    for student in students:
        if student["id"] == u_id:
            student["姓名"] = input('请输入新的班级姓名:')
            student["年龄"] = input('请输入新的班级年龄:')
            student["手机号"] = input('请输入新的班级手机号:')
            print('修改成功!')
            return


def select():
    print(students)


def main():
    """主函数，控制程序运行流程"""
    while True:
        print("欢迎使用班级管理系统")
        print("1. 添加班级信息")
        print("2. 删除班级信息")
        print("3. 修改班级信息")
        print("4. 查询所有班级信息")
        print("5. 退出系统")
        choice = input("请输入功能序号: ")
        if choice == "1":
            add()
        elif choice == "2":
            delete()
        elif choice == "3":
            update()
        elif choice == "4":
            select()
        elif choice == "5":
            print("感谢使用班级管理系统，再见！")
            break
        else:
            print("无效的选择，请重新输入！")



